import 'package:get/get.dart';
import 'package:fate_blind_box/network/http_request.dart';
import 'group_list_member_model.dart';

class GroupPromoteListController extends GetxController {
  String groupListViewId = 'groupListViewId';
  String groupListViewItemId = 'groupListViewItemId';
  List dataList = [];

  void getData(String groupName) async {
    print(groupName+'环信名字');
    if(dataList.isNotEmpty){
      dataList.clear();
    }
    if (groupName.isEmpty) return;
    var res = await HttpRequest.request('easemob/group/listCache', params: {
      "username": groupName,
    });
    if (res is Map) {
      Map resMap = res;
      GroupMemberList memberList = GroupMemberList.fromJson(resMap);
      dataList.addAll(memberList.data ?? []);
      update([groupListViewId]);
    }
  }
}
